package com.jic.order.impl;

import com.jic.common.base.vo.Page;
import com.jic.order.entity.OrderAfterSaleFlowRecordModel;
import com.jic.order.mapper.OrderAfterSaleFlowRecordMapper;
import com.jic.common.base.vo.PageResult;
import com.jic.order.service.OrderAfterSaleFlowRecordService;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *  订单售后流水表 服务类
 *
 * @author xuyongliang
 * @since 2020-02-01
 */
@Service
public class OrderAfterSaleFlowRecordServiceImpl implements OrderAfterSaleFlowRecordService {

    @Autowired
    private OrderAfterSaleFlowRecordMapper modelMapper;

    /**
     * 订单售后流水表 新增
     * @param modelEntity
     */
    @Override
    public Integer orderAfterSaleFlowRecordAdd(OrderAfterSaleFlowRecordModel modelEntity){
        return modelMapper.orderAfterSaleFlowRecordAdd(modelEntity);
    }

    /**
     * 订单售后流水表 编辑
     * @param modifyEntity
     * @param whereCondition
     */
    @Override
    public Integer orderAfterSaleFlowRecordEdit(
            OrderAfterSaleFlowRecordModel modifyEntity,
            OrderAfterSaleFlowRecordModel whereCondition){
        return modelMapper.orderAfterSaleFlowRecordEdit(modifyEntity, whereCondition);
    }

    /**
     * 订单售后流水表 删除
     * @param \
     */
    @Override
    public Integer orderAfterSaleFlowRecordDelete(Map map){
        return modelMapper.orderAfterSaleFlowRecordDelete(map);
    }

    /**
     * 订单售后流水表 查询详情
     * @param
     */
    @Override
    public OrderAfterSaleFlowRecordModel orderAfterSaleFlowRecordQuery(Map map){
        return modelMapper.orderAfterSaleFlowRecordQuery(map);
    }

    /**
     * 订单售后流水表 分页查询
     * @param
     */
    @Override
    public PageResult<OrderAfterSaleFlowRecordModel> orderAfterSaleFlowRecordQueryPageList(OrderAfterSaleFlowRecordModel modelEntity, Page pageQuery){
        //计算下标
        int startIndex = (pageQuery.getStart() - 1) * pageQuery.getLimit();
        List<OrderAfterSaleFlowRecordModel> list = modelMapper.orderAfterSaleFlowRecordQueryPageList(startIndex, pageQuery.getLimit(),modelEntity);
        long count = modelMapper.orderAfterSaleFlowRecordQueryPageCount(modelEntity);
        PageResult pageResult = new PageResult();
        pageResult.setRows(list);
        pageResult.setTotal(count);
        return pageResult;
    }

    /**
    *  订单售后流水表 修改单据状态
    *  @param \
    */
    @Override
    public Integer orderAfterSaleFlowRecordChangeStatus(Map map){
        return modelMapper.orderAfterSaleFlowRecordChangeStatus(map);
    }

    /**
     *  订单售后流水表 修改审批状态
     * @param \
     */
    @Override
    public Integer orderAfterSaleFlowRecordChangeApproveStatus(Map map){
        return modelMapper.orderAfterSaleFlowRecordChangeApproveStatus(map);
    }

}